// 1077:Eight
/* 描述
The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed into a 4 by 4 frame with one tile missing. Let's call the missing tile 'x'; the object of the puzzle is to arrange the tiles so that they are ordered as:
 1  2  3  4
 5  6  7  8
 9 10 11 12
13 14 15  x

where the only legal operation is to exchange 'x' with one of the tiles with which it shares an edge. As an example, the following sequence of moves solves a slightly scrambled puzzle:
 1  2  3  4    1  2  3  4    1  2  3  4    1  2  3  4
 5  6  7  8    5  6  7  8    5  6  7  8    5  6  7  8
 9  x 10 12    9 10  x 12    9 10 11 12    9 10 11 12
13 14 11 15   13 14 11 15   13 14  x 15   13 14 15  x
           r->           d->           r->

The letters in the previous row indicate which neighbor of the 'x' tile is swapped with the 'x' tile at each step; legal values are 'r','l','u' and 'd', for right, left, up, and down, respectively.

Not all puzzles can be solved; in 1870, a man named Sam Loyd was famous for distributing an unsolvable version of the puzzle, and
frustrating many people. In fact, all you have to do to make a regular puzzle into an unsolvable one is to swap two tiles (not counting the missing 'x' tile, of course).

In this problem, you will write a program for solving the less well-known 8-puzzle, composed of tiles on a three by three
arrangement.
输入
You will receive a description of a configuration of the 8 puzzle. The description is just a list of the tiles in their initial positions, with the rows listed from top to bottom, and the tiles listed from left to right within a row, where the tiles are represented by numbers 1 to 8, plus 'x'. For example, this puzzle
 1  2  3
 x  4  6
 7  5  8

is described by this list:

 1 2 3 x 4 6 7 5 8
输出
You will print to standard output either the word ``unsolvable'', if the puzzle has no solution, or a string consisting entirely of the letters 'r', 'l', 'u' and 'd' that describes a series of moves that produce a solution. The string should include no spaces and start at the beginning of the line.

*/



#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<stack>
#include<iostream>
#include<list>
#include<set>
#include<cmath>

#define INF 0x7fffffff
#define eps 1e-8
#define LL long long
#define debug puts("==fuck==")
#define acfun std::ios::sync_with_stdio(false)

using namespace std;

int g[4][4];
int b[]= {1,1,2,6,24,120,720,5040,40320};
int a[]= {40320,5040,720,120,24,6,2,1,1};
struct lx
{
    int can;
    int k;
    int path;
};
int xx[]= {0,0,-1,1};
int yy[]= {1,-1,0,0};
int cantor()
{
    int ans=0;
    int c=0;
    bool vis[10];
    memset(vis,0,sizeof(vis));
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            int s=0;
            for(int k=1; k<g[i][j]; k++)
                if(!vis[k])s++;
            ans+=s*a[c++];
            vis[g[i][j]]=1;
        }
    return ans;
}
int uncantor(int ans)
{
    int t[11];
    int top=0;
    int n=9,s,c;
    bool vis[10];
    memset(vis,0,sizeof(vis));
    while(n--)
    {
        s=ans/b[n];
        c=ans%b[n];
        int tm=0;
        for(int i=1; i<10; i++)
        {
            if(!vis[i])
                tm++;
            if(tm==s+1)
            {
                s=i;
                break;
            }
        }
        vis[s]=1;
        ans=c;
        t[top++]=s;

    }
    top=0;
    int be;
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            g[i][j]=t[top++];
            if(g[i][j]==9)
                be=i*3+j;
        }
    return be;
}
lx q[1000000];
bool vis[1000000];
void show()
{
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
            printf("%d ",g[i][j]);
        printf("\n");
    }
}
int bfs()
{
    int e=0,h=0;
    memset(vis,0,sizeof(vis));
    int can=cantor();
    q[h].can=can;
    q[h].path=-1;
    q[h++].k=-1;
    vis[can]=1;
    while(e!=h)
    {
        can=q[e++].can;
        if(can==0)
        {
            int k=e-1;
            char str[1001];
            int top=0;
            while(q[k].path!=-1)
            {
                if(q[k].k==0)str[top++]='r';
                else if(q[k].k==1)str[top++]='l';
                else if(q[k].k==2)str[top++]='u';
                else str[top++]='d';
                k=q[k].path;
            }
            while(top--)
                printf("%c",str[top]);
            printf("\n");
            return 0;
        }
        int site=uncantor(can);
        int i=site/3;
        int j=site%3;
        for(int k=0; k<4; k++)
        {
            int x=i+xx[k];
            int y=j+yy[k];
            if(x>=3||x<0||y>=3||y<0)continue;
            swap(g[i][j],g[x][y]);
            int tmp=cantor();
            swap(g[i][j],g[x][y]);
            if(vis[tmp])
                continue;
            vis[tmp]=1;
            q[h].can=tmp;
            q[h].path=e-1;
            q[h++].k=k;
        }
    }
    puts("unsolvable");
}

int main()
{
    char str[11];
    while(~scanf("%s",str))
    {
        if(str[0]>='0'&&str[0]<='8')
            g[0][0]=str[0]-'0';
        else
            g[0][0]=9;
        for(int i=1; i<9; i++)
        {
            scanf("%s",str);
            if(str[0]>='0'&&str[0]<='8')
                g[i/3][i%3]=str[0]-'0';
            else
                g[i/3][i%3]=9;
        }
        bfs();
    }
}


// Accepted
